

/*------------------------------------------------------------------------------
	1. Housekeepings
------------------------------------------------------------------------------*/

	*Settings
		set more off
		pause off
		clear
	
	*Set Globals
		global data = "...\Data"
		global output = "...\Output\Tables"
		
		
/*------------------------------------------------------------------------------
	2. Create Table 1:
------------------------------------------------------------------------------*/	

import excel using "${data}\table_backup_data.xlsx", clear first sheet("adj_table")

	foreach i of varlist perc_claimed*{
		replace `i' = `i'*100
	}

	foreach i of varlist perc_claimed*{
		mkmat `i', matrix(`i')
		mat `i' = `i''
	}

cap program drop claim_dat

	program claim_dat, eclass
		*returned in e() structure
		foreach i of varlist perc_claimed*{
			eret mat `i' = `i'
		}
	end

	estimates clear
	eststo clear

	claim_dat
	
#delimit ;
esttab using "$output\adj_table.tex", replace
	booktabs nogaps label noobs collabels(none) nonumber eqlabels(none) nomtitles  substitute(.\\ \\)
	cells("perc_claimed_meps (fmt(%10.1fc)) perc_claimed_imputed (fmt(%10.1fc)) perc_claimed_naive (fmt(%10.1fc)) perc_claimed_benefit (fmt(%10.1fc))") 
	prehead(\begin{table}[htbp]            
			\footnotesize   
			\caption{Imputed Child Claim Rate By Year}
            \label{tab:robust}
			\makebox[\textwidth][c]{                
			\centering  
			\begin{tabular}{l*{4}{c}} 
			\toprule        
			& \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} \\
			\cmidrule(lr){2-5} 
			& \multicolumn{1}{c}{Covariance Adjusted} & \multicolumn{1}{c}{Linear} & \multicolumn{1}{c}{Any Return} & \multicolumn{1}{c}{Any Return} \\
			& \multicolumn{1}{c}{(MEPS)} & \multicolumn{1}{c}{Extrapolation} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{(Likely Resident)}  \\
			\midrule)
	varl(r1 "2017"
	   	 r2 "2018"
	     r3 "2019"
		 r4 "2020"
		 r5 "2021")		
		 postfoot(\midrule 
		 \multicolumn{5}{p{2in}}{\footnotesize{\emph{Notes:"The table reports estimates of the child claim rate by year under alternative assumptions concerning the statistical relationship between child claiming and whether a child appears on a Form 1095. The estimate in Column 1 adjusts for the empirical correlation between child-claiming and health insurance coverage that is present in the MEPS survey data. Column 2 imputes the child claim rate among children without coverage reported on a Form 1095 by linearly extrapolating the relationship between coverage and child claiming observed in our sample and reflected in Appendix Figure \ref{fig:linear}. The reported child claim rate in Column 2 is the weighted average of the baseline child claim rate among insured children (reported in Table \ref{tab:main}, Column 2) and the estimated child claim rate among children without reported coverage that is obtained from this method, where the weights are derived from the estimated share of U.S. children who received a Form 1095 (reported in Table \ref{tab:main}, Column 1). Column 3 is the ratio of children claimed on U.S. tax returns to the number of children present in the U.S., reported by \citet{census_2020}. Column 4 is the same as Column 3, except that the numerator reflects the subset of children claimed on U.S tax returns for the Child Tax Credit or the Earned Income Tax Credit, or who received a Form 1095"} }}        
			\end{tabular}}
			\end{table});;
#delimit cr
